package com.megvii.koala.util;

import android.content.Context;

import com.megvii.corelib.util.SharedPreferenceTool;
import com.megvii.koala.constance.DeviceType;

/**
 * Created by linyue on 16/2/4.
 */
public class PadUtil
{
    public static final String KEY_PAD_MODE = "KEY_PAD_MODE";

    public static final String KEY_PAD_POSITION_SET = "KEY_PAD_POSITION_SET";

    public static final int PAD_MODE_NOT_CHOOSED = -1;

    public static final int PAD_MODE_GUARD = 0;

    public static final int PAD_MODE_VISITOR_RERGISTER = 1;

    public static final int PAD_MODE_SIGN_IN = 2;

    /**
     * 获取设备模式
     * @param context
     * @return
     */
    public static int getPadMode(Context context)
    {
        return SharedPreferenceTool.getIntValueByKey(context, KEY_PAD_MODE, PAD_MODE_NOT_CHOOSED);
    }

    /**
     * 设置设备模式
     * @param context
     */
    public static void setPadMode(Context context, int padMode)
    {
        SharedPreferenceTool.saveIntValue(context, KEY_PAD_MODE, padMode);
    }

    /**
     * 是否设置过门禁位置
     *
     * @param context
     * @return
     */
    public static boolean isPadPositionSet(Context context)
    {
        return SharedPreferenceTool.getBooleanValueByKey(context, KEY_PAD_POSITION_SET, false);
    }

    /**
     * 设置是否设置过门禁位置
     *
     * @param context
     * @param set
     */
    public static void setPadPositionSet(Context context, boolean set)
    {
        SharedPreferenceTool.saveBooleanValue(context, KEY_PAD_POSITION_SET, set);
    }
}
